<!DOCTYPE html>
<html>
	<head>
		<meta charset="utf-8">
		<title>练习</title>
		<script src="js/d3.v4.min.js" charset="utf-8"></script>
	</head>
	<body>
		
		<script>
			//面积图等使用
			//创建画布
			var svg=d3.select("body").append("svg").attr("height",600).attr("width",600);
			var dataset=[[50,120],[130,80],[210,70],[290,30],[370,130],[450,140],[530,110]];
/*			//创建线段
			var linePath=d3.line();
			svg.append("path").attr("d",linePath(dataset))
							  .attr("stroke","black")
							  .attr("stroke-width","3px")
							  .attr("fill","none");*/
			//创建区域 
			var areaPath=d3.area()
							.x(function(d,i){return d[0];})
							.y0(200)
							.y1(function(d,i){return d[1];});
			svg.append("path").attr("d",areaPath(dataset))
							  .attr("stroke","black")
							  .attr("stroke-width","3px")
							  .attr("fill","yellow");
										
		</script>
		
	</body>
</html>
